<template>
	<view class="content">
		<view class="title-first">
			疾病详情
		</view>
		<view class="check-warp">
			<view class="title">
				轻重程度
			</view>
			<view :class="[first==0?'checkBox':'checkN']" @click="selectDegree(0)">
				<view class="checkBtn" v-if="first==0">
					<image src="../../../../static/icon/my_module/healthInfo/select.png"
						style="width: 50rpx;height: 50rpx;"></image>
				</view>
				<view>大卒中（重度）</view>

			</view>
			<view :class="[first==1?'checkBox':'checkN']" @click="selectDegree(1)">
				<view class="checkBtn" v-if="first==1">
					<image src="../../../../static/icon/my_module/healthInfo/select.png"
						style="width: 50rpx;height: 50rpx;"></image>
				</view>
				<view>小卒中（轻度）</view>
			</view>
		</view>
		<view class="check-warp">
			<view class="title">
				病理分类
			</view>
			<view :class="[second==0?'checkBox':'checkN']" @click="selectType(0)">
				<view class="checkBtn" v-if="second==0">
					<image src="../../../../static/icon/my_module/healthInfo/select.png"
						style="width: 50rpx;height: 50rpx;"></image>
				</view>
				<view>缺血性脑卒中</view>


			</view>
			<view :class="[second==1?'checkBox':'checkN']" @click="selectType(1)">
				<view class="checkBtn" v-if="second==1">
					<image src="../../../../static/icon/my_module/healthInfo/select.png"
						style="width: 50rpx;height: 50rpx;"></image>
				</view>
				<view>出血性脑卒中</view>

			</view>
			<view :class="[second==2?'checkBox':'checkN']" @click="selectType(2)">
				<view class="checkBtn" v-if="second==2">
					<image src="../../../../static/icon/my_module/healthInfo/select.png"
						style="width: 50rpx;height: 50rpx;"></image>
				</view>
				<view>混合性脑卒中</view>

			</view>
		</view>

	<!-- 	<view class="submit-box" @click="submit">
			提交信息

		</view> -->
		<view class="btn-box">
			<view @click="jump(0)" class="btn-box">
				<bigBtn :btnBoxWidth="btnBoxWidthL" :btnBoxHeight="btnBoxHeightL" :btnColor="btnColorL" :btnImgSrc="btnImgSrcL"
					:btnText="btnTextL" :btnTextColor="btnTextColorL" :btnTextSize="btnTextSizeL" :btnImgWidth="btnImgWidthL" 
					:btnRadius="btnRadiusL" warpBorderColor="#F5F5F9">
				</bigBtn>
			</view>
			<view @click="submit" class="btn-box">
				<bigBtn :btnBoxWidth="btnBoxWidthR" :btnBoxHeight="btnBoxHeightR" :btnColor="btnColorR" :btnImgSrc="btnImgSrcR"
					:btnText="btnTextR" :btnTextColor="btnTextColorR" :btnTextSize="btnTextSizeR" :btnImgWidth="btnImgWidthR" 
					:btnRadius="btnRadiusR" btnEColor="#0000FF" btnFColor="#00BFFF" warpBorderColor="#F5F5F9">
				</bigBtn>
			</view>
		</view>
<!-- 		<view @click="submit" class="submit-box">
			提交信息
		</view> -->
	</view>
</template>

<script>
	import bigBtn from '@/components/bigButton.vue';
	export default {
		components: {
			bigBtn
		},
		data() {
			return {
				first: 0,
				second: 0,
				firstList: ["大卒中（重度）", "小卒中（轻度）"],
				secondList: ["缺血性脑卒中", "出血性脑卒中", "混合性脑卒中"],
				// u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
				value: 'orange',
				checkboxValue: "",
				checked: true,
				degree: "大卒中（重度）",
				type: "缺血性脑卒中",
				
				// btnBoxWidthR: 300,
				// btnBoxHeightR: 300,
				// btnColorR: "#FD6D62",
				// btnImgSrcR: "",
				// btnTextR: "提交信息",
				// btnTextColorR: "#ffffff",
				// btnTextSizeR: 30,
				// btnImgWidthR: 90,
				// btnRadiusR:135,
				
				btnBoxWidthL: 300,
				btnBoxHeightL: 300,
				btnColorL: "#FD6D62",
				btnImgSrcL: "../../../../static/icon/my_module/healthInfo/LBack.png",
				btnTextL: "上一步",
				btnTextColorL: "#ffffff",
				btnTextSizeL: 30,
				btnImgWidthL: 90,
				btnRadiusL:140,
				
				btnBoxWidthR: 300,
				btnBoxHeightR: 300,
				btnColorR: "#FD6D62",
				btnImgSrcR: "../../../../static/icon/my_module/healthInfo/RBack.png",
				btnTextR: "提交信息",
				btnTextColorR: "#ffffff",
				btnTextSizeR: 30,
				btnImgWidthR: 90,
				btnRadiusR:140,

			};
		},
		methods: {
			selectDegree(index) {
				this.first = index;
				this.degree = this.firstList[index];
			},
			selectType(index) {
				this.second = index;
				this.type = this.secondList[index];
			},
			submit() {
				let me = this;
				let data1 = uni.getStorageSync("tempHealth");
				data1.degree = me.degree;
				data1.illtype = me.type;
				console.log(data1.degree, data1.illtype)
				console.log(data1)
				let token = uni.getStorageSync("usertoken");
				uni.request({
					url: me.serverUrl + "/user/editHealthInfo",
					data: {
						"birthYear": data1.birthyear,
						"illTime": data1.illtime,
						"height": data1.height,
						"weight": data1.weight,
						"surgeryTime": data1.surgerytime,
						"degree": data1.degree,
						"illType": data1.illtype
					},
					header: {
						"usertoken": token
					},
					method: "POST",
					success(res) {
						console.log(res.data)
						if (res.data.status == 200) {
							console.log(res.data)
							uni.setStorageSync("healthInfo", data1);
							// me.sendCode();
						}
					},
					fail: () => {
						uni.showToast({
							duration: 800,
							title: "获取验证码失败"
						})
					}
				})
				uni.switchTab({
					url: "../../../tabBar/training/training"
				})
			},
			jump(index) {
				if (index == 0) {
					uni.navigateBack({
						delta:1
					})
				}
			},
			// 选中某个单选框时，由radio时触发
			radioChange(e) {
				console.log(e);
			},
			// 选中任一radio时，由radio-group触发
			radioGroupChange(e) {
				console.log(e);
			},
			checkboxChange(n) {
				// console.log('change', n);
			}
		}
	};
</script>
<style>
	@import url("ill-details.css");
</style>
